package com.dianrui.moonfire.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.dianrui.moonfire.R;
import com.dianrui.moonfire.interfaces.OnAskDialogCallBack;


public class StartCarDialog {

    public static void createStartCarDialog(final Context context, String title, final OnAskDialogCallBack onAskDialogCallBack) {
        final Dialog dialog = new Dialog(context, R.style.RcDialog);
        View view = LayoutInflater.from(context).inflate(R.layout.start_car_ask, null);
        TextView contentDialogAsk =view.findViewById(R.id.content_dialog_ask);
        final TextView cancelDialogAsk = view.findViewById( R.id.cancel_dialog_ask);
        final TextView yesDialogAsk = view.findViewById(R.id.yes_dialog_ask);
        contentDialogAsk.setText(title);

        cancelDialogAsk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onAskDialogCallBack != null) {
                    onAskDialogCallBack.onCancel(dialog);
                }
            }
        });
        yesDialogAsk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onAskDialogCallBack != null) {
                    onAskDialogCallBack.onokey(dialog);
                }
            }
        });
        dialog.setContentView(view);
        dialog.setCanceledOnTouchOutside(false);
        dialog.show();

    }
}
